gtk: Don't push cairo nodes
authorBenjamin Otte <otte@redhat.com>
Sat, 10 Dec 2016 23:12:02 +0000 (00:12 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 20 Dec 2016 17:01:09 +0000 (18:01 +0100)
We want to split nodes into containers and nodes that do actual drawing.
So pushing nodes that do drawing is exactly the wrong thing.

Also fix up GtkPopover. There's no need for it to push anything.

docs/reference/gtk/gtk4-sections.txt
gtk/gtkpopover.c
gtk/gtksnapshot.c
gtk/gtksnapshot.h

index aff537c030964286e996f44e43606d7b712fbc91..3b6ba53464ff9ab2bf201dc212cd33bed4e5500b 100644 (file)
@@ -4456,7 +4456,6 @@ GtkSnapshot
 gtk_snapshot_get_renderer
 gtk_snapshot_push
 gtk_snapshot_push_node
-gtk_snapshot_push_cairo_node
 gtk_snapshot_pop
 gtk_snapshot_set_transform
 gtk_snapshot_transform
index fce815a3c12bee15b75fafb7c760678976c15196..17a4f2e297ea3ca3a10993e18c6a1d48416acd96 100644 (file)
@@ -1125,9 +1125,9 @@ gtk_popover_snapshot (GtkWidget   *widget,
   graphene_rect_init (&bounds,
                       clip.x - allocation.x, clip.y - allocation.y,
                       clip.width, clip.height);
-  cr = gtk_snapshot_push_cairo_node (snapshot,
-                                     &bounds,
-                                     "Popover");
+  cr = gtk_snapshot_append_cairo_node (snapshot,
+                                       &bounds,
+                                       "Popover");
   /* Render the rect background */
   gtk_render_background (context, cr,
                          rect_x, rect_y,
@@ -1198,8 +1198,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 
   if (child)
     gtk_container_snapshot_child (GTK_CONTAINER (widget), child, snapshot);
-
-  gtk_snapshot_pop (snapshot);
 }
 
 static void
index c7c2bd3214f55172b825da00cad6535009d54bfc..b6025a8b7f2e7255e1b89afaecee1385991353a4 100644 (file)
@@ -432,55 +432,6 @@ gtk_snapshot_append_cairo_node (GtkSnapshot           *snapshot,
   return gsk_render_node_get_draw_context (node, snapshot->renderer);
 }
 
-/**
- * gtk_snapshot_push_cairo_node:
- * @snapshot: a #GtkSnapshot
- * @bounds: the bounds for the new node
- * @name: (transfer none): a printf() style format string for the name for the new node
- * @...: arguments to insert into the format string
- *
- * Creates a new render node, appends it to the current render
- * node of @snapshot, and makes it the new current render node.
- *
- * Returns: a cairo_t suitable for drawing the contents of the newly
- *     created render node
- *
- * Since: 3.90
- */
-cairo_t *
-gtk_snapshot_push_cairo_node (GtkSnapshot            *snapshot,
-                              const graphene_rect_t  *bounds,
-                              const char             *name,
-                              ...)
-{
-  GskRenderNode *node;
-
-  g_return_val_if_fail (snapshot != NULL, NULL);
-  g_return_val_if_fail (bounds != NULL, NULL);
-
-  node = gsk_renderer_create_render_node (snapshot->renderer);
-  gsk_render_node_set_bounds (node, bounds);
-
-  if (name)
-    {
-      va_list args;
-      char *str;
-
-      va_start (args, name);
-      str = g_strdup_vprintf (name, args);
-      va_end (args);
-
-      gsk_render_node_set_name (node, str);
-
-      g_free (str);
-    }
-
-  gtk_snapshot_push_node (snapshot, node);
-  gsk_render_node_unref (node);
-
-  return gsk_render_node_get_draw_context (node, snapshot->renderer);
-}
-
 static void
 rectangle_init_from_graphene (cairo_rectangle_int_t *cairo,
                               const graphene_rect_t *graphene)
index e9811325506afc16ddb249e98d01a1bb13760bde..dbf8b76293ca4cc1a2cd7735ffee502eeafff6a8 100644 (file)
@@ -48,11 +48,6 @@ GDK_AVAILABLE_IN_3_90
 void            gtk_snapshot_push_node                  (GtkSnapshot            *snapshot,
                                                          GskRenderNode          *node);
 GDK_AVAILABLE_IN_3_90
-cairo_t *       gtk_snapshot_push_cairo_node            (GtkSnapshot            *snapshot,
-                                                         const graphene_rect_t  *bounds,
-                                                         const char             *name,
-                                                         ...) G_GNUC_PRINTF(3, 4);
-GDK_AVAILABLE_IN_3_90
 void            gtk_snapshot_pop                        (GtkSnapshot            *snapshot);
 
 GDK_AVAILABLE_IN_3_90